package com.example.service;

import com.example.Product;
import com.example.Users;
import com.example.feign.FeignClientConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 测试feign接口
 *
 * @author sunhui
 */
@FeignClient(name = "CLOUD-ADMIN-ZUUL-GATEWAY", configuration = FeignClientConfig.class,
        fallbackFactory = IZuullClientServiceallbackFactory.class)
public interface IZuulClientService {


    /**
     * 测试接口-根据id查询产品
     *
     * @param id
     * @return
     */
    @RequestMapping("/zuul-api/product-proxy/prodcut/get/{id}")
    public Product getProduct(@PathVariable("id") long id);

    /**
     * 测试接口-查询所有产品
     *
     * @return
     */
    @RequestMapping("/zuul-api/product-proxy/prodcut/list")
    public List<Product> listProduct();

    /**
     * 测试接口-添加产品
     *
     * @param product
     * @return
     */
    @RequestMapping("/zuul-api/product-proxy/prodcut/add")
    public boolean addPorduct(Product product);

    /**
     * 测试接口-根据姓名获取用户信息
     *
     * @param name
     * @return
     */
    @RequestMapping("/zuul-api/users-proxy/users/get/{name}")
    public Users getUsers(@PathVariable("name") String name);
}